import * as Cesium from 'cesium';
var near_water_entity
const bdzMark = function(viewer, pram) {
    near_water_entity = viewer.entities.add(new Cesium.Entity())
    this._viewer = viewer
}

bdzMark.prototype = {
    Add_near_water(Id, lng, lat, imgs) {
        var entity = this._viewer.entities.add({
            id: Id,
            position: Cesium.Cartesian3.fromDegrees(lng, lat),
            billboard: {
                image: imgs, // default: undefined'/static/gltf/变电站.gltf',
                show: true, // default  
                verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // default: CENTER
                scale: 1.5, // default: 1.0
                alignedAxis: Cesium.Cartesian3.ZERO, // default
                width: 25, // default: undefined
                height: 25 // default: undefined
            }
        });
    },
    // 隐藏实体
    removeEntity(id) {
        var buildentity = this._viewer.entities.getById(id);
        buildentity.show = false
    },
    // 根据ID查询到实体类再根据flyTo定位到实体
    getTo(id) {
        var buildentity = this._viewer.entities.getById(id);
        this._viewer.flyTo(buildentity, {
            offset: {
                heading: Cesium.Math.toRadians(0.0),
                pitch: Cesium.Math.toRadians(-45),
                range: 200
            }

        });
    }
}
export default bdzMark